package flc.ast.fragment;

import android.os.Bundle;

import androidx.fragment.app.Fragment;

import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import flc.ast.R;
import flc.ast.activity.CompassActivity;
import flc.ast.activity.DiastimeterActivity;
import flc.ast.activity.FlashLightActivity;
import flc.ast.activity.GradienterActivity;
import flc.ast.activity.MagnifierActivity;
import flc.ast.activity.RulerActivity;
import flc.ast.databinding.FragmentHomeBinding;
import stark.common.basic.base.BaseNoModelFragment;
import stark.common.basic.event.EventStatProxy;

/**
 * A simple {@link Fragment} subclass.
 * Use the {@link HomeFragment#newInstance} factory method to
 * create an instance of this fragment.
 */
public class HomeFragment extends BaseNoModelFragment<FragmentHomeBinding> {


    @Override
    protected int onCreate() {
        return R.layout.fragment_home;
    }

    @Override
    protected void initView() {
        EventStatProxy.getInstance().statEvent1(getActivity(), mDataBinding.event1Container);
        EventStatProxy.getInstance().statEvent5(getActivity(), mDataBinding.event5Container);

        mDataBinding.tvCompass.setOnClickListener(this);
        mDataBinding.tvFlashlight.setOnClickListener(this);
        mDataBinding.tvRuler.setOnClickListener(this);
        mDataBinding.llGradienter.setOnClickListener(this);
        mDataBinding.llDiastimeter.setOnClickListener(this);
        mDataBinding.llMagnifier.setOnClickListener(this);
        mDataBinding.llProtractor.setOnClickListener(this);
    }

    @Override
    protected void onClickCallback(View v) {
        switch (v.getId()) {
            case R.id.tvCompass://指南针
                startActivity(CompassActivity.class);
                break;
            case R.id.tvFlashlight://闪光灯
                startActivity(FlashLightActivity.class);
                break;
            case R.id.tvRuler://刻度尺
                RulerActivity.isRuler = true;
                startActivity(RulerActivity.class);
                break;
            case R.id.llGradienter://水平仪
                startActivity(GradienterActivity.class);
                break;
            case R.id.llDiastimeter://测距仪
                startActivity(DiastimeterActivity.class);
                break;
            case R.id.llMagnifier://放大镜
                startActivity(MagnifierActivity.class);
                break;
            case R.id.llProtractor://量角器
                RulerActivity.isRuler = false;
                startActivity(RulerActivity.class);
                break;
        }
    }

    @Override
    protected void initData() {

    }
}